<extend name="template/base_index" />

<block name="area_header">

    <link rel="stylesheet" href="__CSS__/pay_money.css">
</block>

<block name="area_body">

    <div class="weui_cells weui_cells_access">
        <a class="weui_cell" href="javascript:;">
            <div class="weui_cell_bd weui_cell_primary">
                <p><i class="fa fa-weixin"></i>微信支付</p>
            </div>
            <i class="fa fa-check-circle"></i>
        </a>
    </div>
    <div class="zf-button">
        <a onclick="callpay()" class="weui_btn weui_btn_warn">确定</a>
    </div>
    <script src="__JS__/jquery-weui.min.js"></script>
    <script type="text/javascript">
        //调用微信JS api 支付
        function jsApiCall()
        {
            WeixinJSBridge.invoke(
                    'getBrandWCPayRequest',
                    {$jsApiParameters},
                    function(res){
                        if(res.err_msg === "get_brand_wcpay_request:ok" ) {
                            window.location.href = "{:U('index/index')}";
                        }
                    }
            );
        }
        function callpay()
        {
            if (typeof WeixinJSBridge == "undefined"){
                if( document.addEventListener ){
                    document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
                }else if (document.attachEvent){
                    document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                    document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
                }
            }else{
                jsApiCall();
            }
        }

        window.onload = function(){
            if (typeof WeixinJSBridge == "undefined"){
                if( document.addEventListener ){
                    document.addEventListener('WeixinJSBridgeReady', editAddress, false);
                }else if (document.attachEvent){
                    document.attachEvent('WeixinJSBridgeReady', editAddress);
                    document.attachEvent('onWeixinJSBridgeReady', editAddress);
                }
            }else{
                // editAddress();
            }
        };

    </script>

</block>